//
//  NSObject+math.h
//  helper
//
//  Created by huangyi on 12-10-29.
//  Copyright (c) 2012年 huangyi. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSObject (math)

@end

#define D2R(deg) deg*M_PI/180.0
#define R2D(rad) rad*180.0/M_PI
#define CLAMP(min, n, max) ((n)<(min)?(min):((n)>(max)?(max):(n)))

#define CGRectOne CGRectMake(0,0,1,1)

extern float geo_distance(CGPoint gpsloc1,CGPoint gpsloc2);//x=longitude,y=latitude

extern BOOL col_sphere(CGPoint point,CGPoint circle,CGFloat radius);
extern BOOL col_box(CGPoint point,CGRect rect);
extern BOOL col_hull(CGPoint point,CGPoint polygon[],int count);

extern int str2int(NSString* string);
extern NSString* int2str(int integer);
